New SQL Datasource Reference
The new SQL Datasource type was introduced in Fluent version 25.3.1.
Overview
Prior to version 25.3.1, Fluent used the System.Data.SqlClient
namespace to handle connections to SQL datasources. This has been updated to a newer Microsoft.Data.SqlClient
namespace in recent years so we've made the upgrade as well. This comes with a couple changes which we will discuss.
Connections Encrypted By Default
Although everything in the Microsoft.Data.SqlClient namespace is meant to be backward compatible, there is one big change in functionality. All connections are encrypted by default. This means if you are connecting to a SQL Server that is using a self-signed certificate, you now must explicitly specify TrustServerCertificate=True
in your connection string.
Using the New Datasource
For connecting to the new datasource, everything is pretty much the same. The only changes needed are:
- Updating the
providerName
ortype
in theAdoDataSourceImpl
constructor - Adding
TrustServerCertificate=True
to your connection string if necessary
Examples
SQL Connection using System.Data.SqlClient
var myDs = new AdoDataSourceImpl("System.Data.SqlClient", "Data Source=mssql.windwardreports.com;Initial Catalog=Northwind;user=demo;password=demo;");
SQL Connection using Microsoft.Data.SqlClient
var myDs = new AdoDataSourceImpl("Microsoft.Data.SqlClient", "Data Source=mssql.windwardreports.com;Initial Catalog=Northwind;user=demo;password=demo;TrustServerCertificate=True;");